package com.tiancheng.trade.merchant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 *
 * @author likailun
 * @date 2021/07/19 16:00
 */
@Getter
@AllArgsConstructor
public enum SettlementTypeEnum {

    CLEARING("1", "清分"),
    AUTARKY("2", "自营"),
    PLATFORM("3", "平台");

    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<SettlementTypeEnum> found = Arrays.stream(SettlementTypeEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
